package stringbuilder;

public class Demo2 {
	public static void main(String[] args){
		//long time = System.currentTimeMillis();
		//System.out.println(time);
		System.out.println(Demo2.testString(50000));
		System.out.println(Demo2.testStringBuilder(50000));
	}
	static long testString(int n){
		String s = "";
		long startTime = System.currentTimeMillis();
		for(int i=1;i<n;i++){
			s+="A";
		}
		long endTime = System.currentTimeMillis();
		return endTime-startTime;
	}
	static long testStringBuilder(int n){
		StringBuilder stringBuilder = new StringBuilder();
		long startTime = System.currentTimeMillis();
		for(int i=1;i<n;i++){
			stringBuilder.append("A");
		}
		long endTime = System.currentTimeMillis();
		return endTime-startTime;
	}
}
